home *** CD-ROM | disk | FTP | other *** search
- ; Ripples generator, by Maple Leaf, Nov 1996
- ; "version" 2.0
- ; This code is unoptimized. Even so, it is fast enough for my needs. Isn't
- ; the assembler wonderful ???
- ; a.s.s.e.m.b.l.e.r r.u.u.u.u.u.l.e.z !.!.!.!
- ;----------------------------------------------------------------------------
- ; You may use this piece of code in your productions, as long as you
- ; remember to send some greetings to Maple Leaf (Gruian Radu). Don't be
- ; a selfish lamer, okay? Thanx.
-
- GapsFilling = 1 ; 0 = the upper and lower "gaps" will be filled
- ; with black (background colour)
- ; 1 = the gaps will be filled with pixels which
- ; appear in the opposite part of the screen.
- ;
- ; I don't advise you to put here another value
- ; different from 0 or 1...
-
- .model TPascal
- .386
-
- .DATA
-
- extrn Img:DWORD
- extrn vScr:WORD
- extrn sqrTab:WORD
- extrn Wave:WORD
-
- .CODE
-
- public DrawRipples
-
- include jumps.inc
-
- ;--- psycho !!! -------------------------------------------------------------
-
- proc DrawRipples near
-
- pusha
- push ds es fs gs bp
- mov cx,64000 ; the whole virtual screen
-
- mov di,0 ; offs=0
- mov bx,0 ; x=0
- mov dx,0 ; y=0
-
- mov es,vScr
- push ds
- pop fs
- assume fs:DATA
- mov gs,fs:sqrTab
- mov ds,fs:Img[2]
-
- @ML: mov ax,bx ; ax=x
- sub ax,160 ; ax=x-160
- sjge @ge1
- neg ax
-
- @ge1: mov si,dx ; si=y
- sub si,100 ; si=y-100
- sjge @ge2
- neg si
-
- @ge2: mov bp,si
- shl si,7
- add si,bp
- shl bp,5
- add si,bp ; si = yy*161 = (yy shl 7 + yy shl 5 + yy)
- add si,ax ; ... + xx
- add si,si ; (...)*2
-
- mov si,gs:[si] ; si = sqrTab:[...] = distance to origin
- add si,si
- mov si,fs:Wave[si] ; si = Wave[distance] = altitude of this point
-
- add si,dx ; si = y + Altitude
- sjl less2 ;
- go2: cmp si,199 ; check if range 0-199
- sja above2 ;
- go3:
- mov bp,si
- shl si,8
- shl bp,6
- add si,bp ; si = (y+Altitude) * 320
- add si,bx ; ... + x
-
- mov al,[si] ;
- go4: mov es:[di],al ; copy that motherfucking byte
- inc di ;
-
- inc bx ; inc(x)
- cmp bx,319 ; out of range ?
- sja above ; next y !
-
- @goon: dec cx
- jnz @ML
-
- pop bp gs fs es ds
- popa
-
- retn
-
- above2:
-
- IF GapsFilling ne 0
- sub si,200 ;
- jmp short go3 ; these two will use the opposite extremes to fill the gaps
- ENDIF
-
- IF GapsFilling ne 1
- mov al,0 ;
- jmp short go4 ; these two will fill with black the extreme portions
- ENDIF
-
- less2:
-
- IF GapsFilling ne 0
- add si,200 ;
- jmp short go2 ; these two will use the opposite extremes to fill the gaps
- ENDIF
-
- IF GapsFilling ne 1
- mov al,0 ;
- jmp short go4 ; these two will fill with black the extreme portions
- ENDIF
-
- above: mov bx,0 ; mov x,0
- inc dx ; inc y
- jmp short @goon
-
- endp DrawRipples
-
-
- END